package org.hfy.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.hfy.dto.OutsourcingQueryDTO;
import org.hfy.entity.Outsourcing;

import java.util.List;

/**
 * 外发加工Mapper接口
 * 
 * @author hfy
 * @version 1.0
 */
@Mapper
public interface OutsourcingMapper extends BaseMapper<Outsourcing> {

    /**
     * 分页查询外发加工列表
     */
    IPage<Outsourcing> selectOutsourcingPage(Page<Outsourcing> page, @Param("query") OutsourcingQueryDTO query);

    /**
     * 根据ID查询外发加工详情（包含报价单和明细信息）
     */
    Outsourcing selectOutsourcingWithDetailsById(@Param("id") Long id);

    /**
     * 查询外发加工列表（不分页）
     */
    List<Outsourcing> selectOutsourcingList(@Param("query") OutsourcingQueryDTO query);

    /**
     * 生成外发单号
     */
    String generateOutsourcingNo();

    /**
     * 检查外发单号是否存在
     */
    boolean existsOutsourcingNo(@Param("outsourcingNo") String outsourcingNo);
} 